package com.yitiao.controller;

import com.yitiao.domain.CommerceOrder;
import com.yitiao.service.CommerceOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
@RequiredArgsConstructor
@Slf4j
public class OrderController {

    private final CommerceOrderService orderService;

    @PostMapping("/place")
    public void placeOrder(@RequestBody CommerceOrder order){
        log.info("placeOrder:order:{}",order);
        orderService.addOrder(order);
    }
}
